﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using seiacpscs_a2.datastructures.tree;

namespace seiacpscs_a2_test.datastructures.tree
{
    [TestClass]
    public class BinarySearchTreeRecursiveTestCase
    {
        private BinarySearchTreeRecursive tree;

        [TestInitialize]
        public void setup()
        {
            this.tree = new BinarySearchTreeRecursive();
        }

        [TestMethod]
        public void TestSizeWithZeroItems()
        {
            Assert.AreEqual(0, this.tree.Size);
        }

        [TestMethod]
        public void TestSizeWithTwoItems()
        {
            tree.addItems(5, 6);
            Assert.AreEqual(2, this.tree.Size);
        }

        [TestMethod]
        public void TestSearchWithZeroItems()
        {   
            Assert.AreEqual(false, this.tree.contains(4));
            Assert.AreEqual(0, this.tree.NumberOfAccesses);
        }

        [TestMethod]
        public void TestSearchWithTwoItems()
        {
            this.tree.addItems(4, 3);
            Assert.AreEqual(true, this.tree.contains(3));
            Assert.AreEqual(2, this.tree.NumberOfAccesses);
        }
    }
}
